/////////////////////////////////////////////////////////////////////////////
// Defines a interface for exceptions.
//
// Version 1.0 - 15 june 2007
//
// Copyright (c) 2007 by FlexByte Software (http://flexbyte.com)
// All rights reserved.
//
// You may use the source code in any product (freeware, commercial, etc.). 
// You may modify the source code as you want except 
// you cannot modify the copyright details at the top of each module.
// If you have a web site or blog give a link to our web site, flexbyte.com
/////////////////////////////////////////////////////////////////////////////
#ifndef __FLEX_EXCEPTION_H
#define __FLEX_EXCEPTION_H
#include <string>
/////////////////////////////////////////////////////////////////////////////
class CFlexException
{
public:
// Constructor
	CFlexException(const char * szReason, bool bShow = false)
		: m_sReason( szReason )
		, m_dwErrorCode( 0 )
		, m_bShow( bShow )
	{
	}

	CFlexException(DWORD dwErrorCode, bool bShow = false)
		: m_dwErrorCode( dwErrorCode )
		, m_bShow( bShow )
	{
	}

	CFlexException(const char * szReason, DWORD dwErrorCode, bool bShow = false)
		: m_sReason( szReason )
		, m_dwErrorCode( dwErrorCode )
		, m_bShow( bShow )
	{
	}

// Implementation
	virtual const char * GetReason() const
	{
		return m_sReason.c_str();
	}

	virtual DWORD GetErrorCode() const
	{
		return m_dwErrorCode;
	}

	virtual bool Show() const
	{
		return m_bShow;
	}

// Members
private:
	DWORD			m_dwErrorCode;
	std::string		m_sReason;
	bool			m_bShow;
};
#define TRACE OutputDebugString
/////////////////////////////////////////////////////////////////////////////
#endif // __FLEX_EXCEPTION_H
